package com.ricchieri.bean;

import java.io.Serializable;
import java.sql.Time;
import java.util.Date;
import java.util.List;

import com.ricchieri.common.BusinessSettings;
import com.ricchieri.util.DateUtil;
import com.ricchieri.util.FacesUtil;

public class FixedReservationBean implements Serializable {

	private static final long serialVersionUID = -8719167212008678699L;
	private Date startDate;
	private Date finishDate;
	private String selectedReservationType;
	private String selectedPassengerType;
	private String selectedMeanPayment;
	private Double cost;
	private String upOn;
	private String downOn;
	private String observation;
	private String trip;
	private List<String> selectedDays;
	private Date time;
	
	public Date getStartDate() {
		return startDate;
	}
	
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	public Date getFinishDate() {
		return finishDate;
	}
	
	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}
	
	public String getSelectedReservationType() {
		return selectedReservationType;
	}
	
	public void setSelectedReservationType(String selectedReservationType) {
		this.selectedReservationType = selectedReservationType;
	}
	
	public String getSelectedPassengerType() {
		return selectedPassengerType;
	}
	
	public void setSelectedPassengerType(String selectedPassengerType) {
		this.selectedPassengerType = selectedPassengerType;
	}
	
	public String getSelectedMeanPayment() {
		return selectedMeanPayment;
	}
	
	public void setSelectedMeanPayment(String selectedMeanPayment) {
		this.selectedMeanPayment = selectedMeanPayment;
	}
	
	public Double getCost() {
		return cost;
	}
	
	public void setCost(Double cost) {
		this.cost = cost;
	}
	
	public String getUpOn() {
		return upOn;
	}
	
	public void setUpOn(String upOn) {
		this.upOn = upOn;
	}
	
	public String getDownOn() {
		return downOn;
	}
	
	public void setDownOn(String downOn) {
		this.downOn = downOn;
	}
	
	public String getObservation() {
		return observation;
	}
	
	public void setObservation(String observation) {
		this.observation = observation;
	}

	public String getTrip() {
		return trip;
	}

	public void setTrip(String trip) {
		this.trip = trip;
	}

	public List<String> getSelectedDays() {
		return selectedDays;
	}

	public void setSelectedDays(List<String> selectedDays) {
		this.selectedDays = selectedDays;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	
	public Time getTimeWithFormat() {
		return DateUtil.convertToTime(time);
	}
	
	public String obtainDescriptionSelectedDays() {
		String result = "";
		for (String day : getSelectedDays()) {
			
			if(result.length() > 0) {
				result = result.concat(", ");
			}
			
			if(day.equals(BusinessSettings.DAY_FRIDAY)) {
				result = result.concat(FacesUtil.getMessage("friday"));
			} else 	if(day.equals(BusinessSettings.DAY_MONDAY)) {
				result = result.concat(FacesUtil.getMessage("monday"));
			} else 	if(day.equals(BusinessSettings.DAY_SATURDAY)) {
				result = result.concat(FacesUtil.getMessage("saturday"));
			} else 	if(day.equals(BusinessSettings.DAY_SUNDAY)) {
				result = result.concat(FacesUtil.getMessage("sunday"));
			} else 	if(day.equals(BusinessSettings.DAY_THURSDAY)) {
				result = result.concat(FacesUtil.getMessage("thursday"));
			} else 	if(day.equals(BusinessSettings.DAY_TUESDAY)) {
				result = result.concat(FacesUtil.getMessage("tuesday"));
			} else 	if(day.equals(BusinessSettings.DAY_WEDNESDAY)) {
				result = result.concat(FacesUtil.getMessage("wednesday"));
			} 
		}
		return result;
	}
}
